package it.antonio.ilpizze.mock;

import it.antonio.ilpizze.mock.expectation.ObjectReturnExpectation;
import it.antonio.ilpizze.mock.expectation.RealMethodExpectation;
import it.antonio.ilpizze.mock.expectation.ThrowableExpectation;

public class Stubber<T> {

        private MockHandler mockHandler;
        
        public Stubber(MockHandler mockHandler) {
                this.mockHandler = mockHandler;
        }
        
        public void thenReturn(T object) {
                ObjectReturnExpectation<T> exp = new ObjectReturnExpectation<T>(object);
                mockHandler.registerExpectation(exp);
        }

        public void thenThrow(Throwable throwable) {
                ThrowableExpectation exp = new ThrowableExpectation(throwable);
                mockHandler.registerExpectation(exp);
        }

        public void thenCallRealMethod() {
            mockHandler.registerExpectation(new RealMethodExpectation());
        }

}